package definite.Guide.Book.Menu;

import java.awt.Component;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JOptionPane;

// define abstract action
public class ShowAction extends AbstractAction {

	Component parentComp;

	public ShowAction(Component parentComponent) {
		super("About");
		putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A));
		parentComp = parentComponent;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		Runnable run = new Runnable() {

			@Override
			public void run() {
				JOptionPane.showMessageDialog(parentComp, "About Swing",
						"About Box V2.0", JOptionPane.INFORMATION_MESSAGE);
			}
		};

		EventQueue.invokeLater(run);
	}

} // end of action